//
// Description: 506. 相对名次
// Created by Loading on 2021/12/2.
//

#include <bits/stdc++.h>

using namespace std;

vector<string> findRelativeRanks(vector<int> &score) {
    int n = score.size();
    std::string desc[3] = {"Gold Medal", "Silver Medal", "Bronze Medal"};
    vector<pair<int, int>> vec;
    for (int i = 0; i < n; ++i) {
        vec.emplace_back(make_pair(score[i], i));
    }
    sort(vec.begin(), vec.end());

    vector<string> result(vec.size());
    for (int i = n - 1; i >= 0; --i) {
        if (i >= n - 3) {
            result[vec[i].second] = desc[n - i - 1];
        } else {
            result[vec[i].second] = to_string(n - i);
        }
    }

    return result;
}

int main() {
    vector<int> score = {5, 4, 3, 2, 1};
    vector<string> result = findRelativeRanks(score);
    for (auto &s : result) {
        cout << s << ' ';
    }
    cout << endl;

    return 0;
}